package com.jc.common.util;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;

import org.apache.commons.lang3.StringUtils;

public class FileUtil {
	
	
	public static String getFilePath(String fileFullPath) {
		
		return null;
		
	}
	
	
	
	
	public static String getFileExtName(String fileFullPath) {
		if(StringUtils.isNotBlank(fileFullPath) && fileFullPath.indexOf(".") > 0) {
			return fileFullPath.substring(fileFullPath.lastIndexOf(".") + 1, fileFullPath.length() );
		}
		return null;
	}
	
	
	
	
	public static void wrtieFile(String files,String context) {
		  File file = new File(files);
		  try (FileOutputStream fop = new FileOutputStream(file,true)) {
		   if (!file.exists()) {
		    file.createNewFile();
		   }
		   byte[] contentInBytes = context.getBytes();
		   fop.write("\r\n".getBytes());
		   fop.write(contentInBytes);
		   //fop.write("\r\n".getBytes());
		   fop.flush();
		   fop.close();
		  } catch (IOException e) {
		      e.printStackTrace();
		  }
	}
	
	
	

}
